package com.nbjtjc.safe.api.wechat;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.service.wechat.WechatDangerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @auther guqianbin
 * @date 2018/10/11 10:53
 * 小程序隐患的接口
 **/
@RestController
@RequestMapping("/wechat")
@CrossOrigin("*")
public class WechatDangerController {

    @Autowired
    private WechatDangerService wechatDangerService;

    /**
     * 获取小程序 隐患检查4个状态的任务数量
     * @return
     */
    @GetMapping("/dangerTaskTypeCount")
    @ApiOperation(value = "获取小程序 隐患检查4个状态的任务数量")
    public Result dangerTaskTypeCount(){
        Result result=new Result();
        result.setData(wechatDangerService.dangerTaskTypeCount());
        return result;
    }

    /**
     * 获取小程序 隐患检查4个状态的任务数量
     * @return
     */
    @PostMapping("/taskTypeCount")
    @ApiOperation(value = "获取小程序 隐患检查4个状态的任务数量")
    public Result taskTypeCount(@RequestParam(value = "taskDefineKeys")List<String> taskDefineKeys
            ,@RequestParam("processDefineKey") String processDefineKey){
        Result result=new Result();
        result.setData(wechatDangerService.emgTaskCount(taskDefineKeys,processDefineKey));
        return result;
    }

    /**
     * 获取小程序 公司的选择
     * @return
     */
    @GetMapping("/companySelectors")
    @ApiOperation(value = "获取小程序 公司的选择")
    public Result getCompanySelectors(){
        Result result=new Result();
        result.setData(wechatDangerService.getCompanySelectors());
        return result;
    }
}
